﻿@model Toasts.Models.Submission

@{
    ViewBag.Title = "Submit";
}

@if (@User.Identity.IsAuthenticated)
{
<div id="body">
    <div class="page">
        <div class="page-header">
            <div class="page-header-content">
                <h1>Edit Submitted Toasts</h1>
            </div>
        </div>
        <div class="page-region">
            <div class="page-region-content">


                <div class="grid">
                    <div id="toast-content">
                        <div class="row">
                            <div class="span9 offset2">
                                <div class="toast-editor">


                                    <div class="input-control textarea">
                                        @Html.TextAreaFor(model => model.Content, new { rows = 10, data_bind="value: Content", style=" font-size:14pt; line-height: 1.5"})
                                        @Html.ValidationMessageFor(model => model.Content)
                                    </div>
                                    <span class="control left bg-color-blue" data-bind="click: previous">&#8249;</span>
                                    <span class="control right bg-color-blue" data-bind="click: next">&#8250;</span>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="span9 offset2">
                                <div class="span5">
                                    <div>Occasion</div>
                                    <div class="input-control select">
                                        <select id="Occasion" name="Occasion" data-bind= "value: Occasion">
                                            <option>Drink</option>
                                            <option>Food</option>
                                            <option>Health</option>
                                            <option>Christmas</option>
                                            <option>New Year</option>
                                            <option>Birthday</option>
                                            <option>Wedding</option>
                                            <option>Anniversary</option>
                                            <option>Age</option>
                                        </select>
                                        <div>@Html.ValidationMessageFor(model => model.Occasion)</div>
                                    </div>
                                </div>
                                <div class="span4">
                                    <div>Origin</div>
                                    <div class="input-control select">
                                        <select id="Origin" name="Origin" data-bind= "value: Origin">
                                             <option>Irish</option>
                                             <option>American</option>
                                             <option>Klingon</option>
                                             <option>French</option>
                                             <option>Italian</option>
                                             <option>British</option>
                                             <option>Polish</option>
                                             <option>Japanese</option>
                                             <option>German</option>
                                             <option>Spanish</option>
                                             <option>Greek</option>
                                             <option>Swedish</option>
                                            <option>Austrian</option>
                                        </select>
                                        <div>@Html.ValidationMessageFor(model => model.Origin)</div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="span9 offset2">
                                <div class="span5">
                                    <div>Website</div>
                                    <div class="input-control">
                                        @Html.TextBoxFor(model => model.Website, new   { data_bind= "value: Website"})
                                        @Html.ValidationMessageFor(model => model.Website)
                                    </div>
                                </div>
                                <div class="span4">
                                    <div>Author</div>
                                    <div class="input-control">
                                        @Html.TextBoxFor(model => model.Author, new   { data_bind= "value: Author"})
                                        @Html.ValidationMessageFor(model => model.Author)
                                    </div>
                                </div>

                            </div>
                        </div>

                        <div class="row">
                            <div class="span9 offset2">
                                <div class="span4 offset5">
                                    <div>Accept or Reject?</div>
                                    <div class="input-control select">
                                        <select id="Status" name="Status" data-bind= "value: Status">
                                            <option>Pending</option>
                                            <option>Accepted</option>
                                            <option>Rejected</option>
                                        </select>
                                        <div>@Html.ValidationMessageFor(model => model.Status)</div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="span9 offset2">

                            <div class="span3">
                                <a href="/" class="button bg-color-blue fg-color-white">Cancel
                                       
                                </a>
                            </div>
                            <div class="span3">
                                <button type="submit" value="Create" class="command-button bg-color-blue fg-color-white" data-bind="click: updateSubmissions">
                                    Save accepted submission in the database and delete rejected ones.                               
                                </button>
                            </div>

                        </div>

                    </div>



                </div>

            </div>
        </div>
    </div>
</div>
} else
{
    <section id="localLoginPanel">
        <div class="page">
            <div class="page-header">
                <div class="page-header-content">
                    <h1>Log in</h1>
                </div>
            </div>
            <div class="page-region">
                <div class="page-region-content">


                    <div class="grid">

                        <div class="row">
                            <div class="span5 offset3">

                                @Html.Partial("_Login")


                            </div>
                            <div>
                                <h3>For demo users</h3>
                                <div> User name: demo</div>
                                <div>Password: password</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    
}



@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    @Scripts.Render("~/bundles/ko")   
    @Scripts.Render("~/bundles/edit")
 
}
